#ifndef SCREENQUAD_HPP_
#define SCREENQUAD_HPP_

#include <aerOpenGL.hpp>

// Actually, it does not draw a screen quad but 3 random points.
// Only useful with the appropriate vertex shader to create a triangle mapped 
// to fit the screen as a quad.
class ScreenQuad
{
  private:
    struct VAO_t
    {
      VAO_t() : vao(0u) {glGenVertexArrays( 1, &vao);}
      ~VAO_t() {if (vao) glDeleteVertexArrays( 1, &vao);}
      
      void begin() { glBindVertexArray( vao ); }
      void end() { glBindVertexArray( 0u ); }
      GLuint vao;
    };
      
  public:
    static void Draw()
    {
      static VAO_t sVAO;
      
      sVAO.begin();
        glDrawArrays( GL_TRIANGLES, 0, 3);
      sVAO.end();
    }
};

#endif // SCREENQUAD_HPP_
